package face.pay.web.device.controller;

import face.pay.entity.DeviceBatchInfo;
import face.pay.entity.DeviceOrderInfo;
import face.pay.entity.UserInfo;
import face.pay.security.annotation.CurrentUser;
import face.pay.util.page.PageData;
import face.pay.util.page.PageParam;
import face.pay.web.device.service.DeviceBatchInfoService;
import face.pay.web.device.service.DeviceOrderInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Classname DeviceBatchInfoController
 * @Description JJL
 * @Date 2019/11/12 12:06
 * 导入批次
 */
@Controller
@RequestMapping("/deviceBatch")
public class DeviceBatchInfoController {

    @Autowired
    private DeviceBatchInfoService deviceBatchInfoService;

    @Autowired
    private DeviceOrderInfoService deviceOrderInfoService;

    @RequestMapping("/list")
    public String manager(){
        return  "device/deviceBatchInfoList";
    }

    /**
     * 查询
     * @param loginUser 当前登录用户
     * @param pageParam 分页
     * @param deviceBatchInfo 查询对象
     * @return
     */
    @RequestMapping("/queryData")
    @ResponseBody
    public PageData data(@CurrentUser UserInfo loginUser, PageParam pageParam, DeviceBatchInfo deviceBatchInfo){
        return deviceBatchInfoService.queryPage(loginUser,pageParam,deviceBatchInfo);
    }

    /**
     * admin根据批次查询设备
     * @param loginUser
     * @param pageParam
     * @param deviceBatchId
     * @return
     */
    @RequestMapping("/queryDeviceOrderData")
    @ResponseBody
    public PageData data(@CurrentUser UserInfo loginUser, PageParam pageParam, Integer deviceBatchId){
        return deviceOrderInfoService.getBatchIdInfo(pageParam,deviceBatchId);
    }

}
